package com.xhwl.centiotdata.handler.account;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
 * @author pengjunming
 * @description
 * @date 2022/7/5 10:28
 */
public class AccountFactory {

    private static Map<Integer, AccountHandler> handlerMap = new HashMap<>(16);

    public static AccountHandler getInvokeStrategy(Integer id) {
        return handlerMap.get(id);
    }

    public static void register(Integer id, AccountHandler handler) {
        if (Objects.isNull(id)) {
            return;
        }
        handlerMap.putIfAbsent(id, handler);
    }
}
